package com.ssm.study.controller;

import com.ssm.study.entity.Admin;
import com.ssm.study.service.IAdminService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServlet;
import java.util.List;

/**
 * Created by w on 2017/4/16.
 */

@Controller
@RequestMapping("/admin")
public class AdminController extends HttpServlet {

    @Resource
    IAdminService adminService;

    @RequestMapping(value = "list", method = RequestMethod.GET)
    @ResponseBody
    public ModelAndView adminList() {
        ModelAndView mav = new ModelAndView("admin_info");

        List<Admin> adminList = adminService.getAllAdmins();

        mav.addObject("adminList", adminList );

        return mav;
    }



}
